<template>
  <div class="dialog-overlay">
    <div class="dialog-content">
      <h3>{{ point.id ? '编辑点位' : '新增点位' }}</h3>

      <div class="form-group">
        <label>点位名称</label>
        <input v-model="editingPoint.name" type="text">
      </div>

      <div class="form-group">
        <label>状态</label>
        <select v-model="editingPoint.status">
          <option value="active">启用</option>
          <option value="inactive">停用</option>
        </select>
      </div>

      <div class="dialog-actions">
        <button @click="save">保存</button>
        <button @click="close">取消</button>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    point: {
      type: Object,
      default: () => ({})
    }
  },
  data() {
    return {
      editingPoint: {...this.point}
    }
  },
  methods: {
    save() {
      this.$emit('save', this.editingPoint)
    },
    close() {
      this.$emit('close')
    }
  }
}
</script>

<style scoped>
.dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.dialog-content {
  background-color: white;
  padding: 20px;
  border-radius: 5px;
  width: 400px;
}

.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 8px;
  box-sizing: border-box;
}

.dialog-actions {
  text-align: right;
  margin-top: 20px;
}

.dialog-actions button {
  margin-left: 10px;
}
</style>